package org.bw.bookstore.book.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.bw.bookstore.book.service.UserFlowRecordService;
import org.bw.bookstore.common.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author GuoShuai
 * @Date 2020-10-22 下午 02:10
 * 用户流动控制层
 * @Version 1.0
 **/
@RestController
@CrossOrigin
@Slf4j
@RequestMapping("/userFlowRecord")
@Api(tags = "接口-用户进出店记录")
public class UserFlowRecordController {
    @Autowired
    UserFlowRecordService userFlowRecordService;
    /**
     * TODO 郭帅帅 用户进店后保存用户进店记录
     * @Description:
     * @Author: guoshuai
     * @Date: 2020-10-20 上午 10:02
     * @param userInfoId:传入当前用户的id
     * @return: void
     **/
    @ApiOperation(value = "用户进店记录", notes = "用户进店记录")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "userInfoId", value = "当前用户", dataType = "Integer", required = true),
    })
    @PostMapping("/progress")
    public ResponseResult progressRecord(Integer userInfoId){
       return userFlowRecordService.progressRecord(userInfoId);
    };
    /**
     * TODO 郭帅帅 保存用户出店记录
     * @Description:
     * @Author: guoshuai
     * @Date: 2020-10-20 上午 10:02
     * @param userInfoId:传入当前用户的id
     * @return: void
     **/
    @ApiOperation(value = "用户出店记录", notes = "用户出店记录")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "userInfoId", value = "当前用户", dataType = "Integer", required = true),
    })
    @PostMapping("/outInto")
    public ResponseResult  outIntoRecord(Integer userInfoId){
        return userFlowRecordService.outIntoRecord(userInfoId);
    };
    /**
     * TODO 郭帅帅 查询用户流动记录
     * @Description:
     * @Author: guoshuai
     * @Date: 2020-10-20 上午 10:02
     * @param userInfoId:传入用户的id
     * @return: void
     **/
    @PostMapping("/flowrecord")
    @ApiOperation(value = "获取用户流动记录", notes = "获取用户流动记录")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "userInfoId", value = "当前用户", dataType = "Integer", required = true),

    })
    public ResponseResult  flowRecord(Integer userInfoId){
        return userFlowRecordService.flowRecord(userInfoId);
    };

}
